//1.导入vue路由
import Vue from 'vue'
import VueRouter from 'vue-router';
import demo from './main/demo.vue'
import compoentList from './main/componentTest.vue'
import watchTest from './main/WatchTest.vue'
import index from './main/index.vue';
import register from './main/register.vue';
import one from './main/one.vue';
import compute from './main/compute.vue';
import xlcss from './main/xlcss.vue'
import myform from './main/myform.vue'
import routerTest from './main/routerTest.vue'
import routerTest2 from './main/routerTest2.vue'
//导入没有.vue会报错
//2.使用vue路由
Vue.use(VueRouter)
// 3.创建路由对象,"/" 默认显示组件
var router = new VueRouter(
    {
        // mode: 'history',
        //嵌套路由也需要router-view，用children数组
        //客户端重定向和服务器的重定向是两码事
        routes: [{path: '/', redirect: '/demo'}, {
            path: '/index', components: {
                'default': index,
                'main': register
            }
        }, {
            path: '/demo', component: demo, children: [{
                path: 'one', component: one
            }
            ]
        }, {
            path: '/compoentList',
            component: compoentList
        }, {path: '/watchTest', component: watchTest}
            , {path: '/compute', component: compute}, {path: '/xlcss', component: xlcss}
            , {path: '/myform', component: myform}, {path: '/routerTest', component: routerTest}, {
                path: '/routerTest2',
                component: routerTest2
            }
        ]
    }
)
//暴露路由对象
export default router;
